//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <iostream>

#include "ListLigandEpitopeAlignment.h"
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
using namespace std;
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
int main (int argc, char** argv) {
  
  String* namefileEpitopeAlignment = NULL;
  String* namefileLigandSMI        = NULL;
  String* namefileOut              = NULL;

  if (argc < 4) {
    
    cout << "Error in the input parameters! Must by like: " << endl;
    cout << "./PlotEpitopeAligmentUsingLSIMMatrix <Ligand Epitope Alignment File>";
    cout <<                                     " <Ligand SMI File>";
    cout <<                                     " <Out File>";
    cout << endl;
    
    return 0;
    
  }
  else {
    
    namefileEpitopeAlignment = new String(argv[1]);
    namefileLigandSMI        = new String(argv[2]);
    namefileOut              = new String(argv[3]);
    
    cout << "---------------------------------------------------------------------------------" << endl;
    cout << " Ligand Epitope Alignment File : " << argv[1] << endl;
    cout << "               Ligand SMI File : " << argv[2] << endl;
    cout << "                      Out File : " << argv[3] << endl;
    cout << "---------------------------------------------------------------------------------" << endl;
    
  }
  
  ListLigandEpitopeAlignment* listLigandEpitopeAlignment = new ListLigandEpitopeAlignment ();
  
  cout << "Preparing Files..." << endl;
  listLigandEpitopeAlignment->FilenameIn(namefileEpitopeAlignment);
  listLigandEpitopeAlignment->FilenameSMI(namefileLigandSMI);
  listLigandEpitopeAlignment->FilenameOut(namefileOut);
  
  cout << "Loading Files..." << endl;
  listLigandEpitopeAlignment->LoadDataLigandEpitopeAligment();
  listLigandEpitopeAlignment->LoadDataSMI();
  
  cout << "Writing the Matrix..." << endl;
  listLigandEpitopeAlignment->WriteMatrixEpitopeAligment();
  
  cout << "Finished..." << endl << "Good Bye" << endl;
  
  if (listLigandEpitopeAlignment) delete listLigandEpitopeAlignment;
  
  if (namefileEpitopeAlignment)   delete namefileEpitopeAlignment;
  if (namefileLigandSMI)          delete namefileLigandSMI;
  if (namefileOut)                delete namefileOut;

  return EXIT_SUCCESS;
  
}
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//

